#pragma once

#include "Sheet.h"
#include <vector>

namespace ExcelLibrary
{
	class CFile : public IFile
	{
	public:
		CFile();
		~CFile();

		HRESULT STDMETHODCALLTYPE QueryInterface( 
            /* [in] */ REFIID riid,
            /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
        
        ULONG STDMETHODCALLTYPE AddRef(void);
        ULONG STDMETHODCALLTYPE Release(void);

		bool Open(const wchar_t* pFileName);

		ISheet* LoadSheet(const wchar_t* pSheetName);
		const wchar_t* GetSheetName(unsigned long ulSheetIdx);
		unsigned long GetSheetCount();

	private:
		DWORD m_dwRefCount;
		_Connection* m_pConnection;
		_Command* m_pCommand;
		_Recordset* m_pRecordset;
		std::vector<std::wstring> m_SheetNames;
	};
}
